<template>
	<div class="main">
		
	</div>
</template>
<script>
	//引入js
	import router from '@/router/index'
	import { createToken } from '@/api/student'

	export default {
		components: {
			
		},
		data() {
			return {
				baseUrl:process.env.VUE_APP_BASE_API,
			}
		},
		created:async function() {
			var ajaxData={}
			ajaxData.id = "63238217b331459bae676c89b2e7cc7f"
			var resultData=await createToken(ajaxData);
			
			if(resultData.code==200)
			{
				//存起来token和身份信息
				var expireTime=Date.parse(new Date())/1000+72000;//20小时后过期
				//同步更新store
				this.$store.commit("setIdentity",1);
				this.$store.commit("setToken",resultData.data);
				this.$store.commit("setExpireTime",expireTime);
				 /*存储到ls*/
				localStorage.setItem('identity',1);
				localStorage.setItem('token',resultData.data);
				localStorage.setItem('expireTime',expireTime);
				router.push({path:"/wechatstudent/loading"});
				return 0;
			}
			
		},
		beforeMount: function() {
			
		},
		mounted: function() {
			
		},
		methods: {
		}
	}
</script>
<style lang="scss" scoped>
	.main{
		width: 100%;
		overflow: hidden;
		
	}
</style>
